<?php
namespace jy_robshop;
defined('BY_JYA') or exit('error');
/*
	任务
*/
class task extends \plugin{
	//计划任务
	public function up_day(){
		$this->model('team')->get_store_per();
		$this->up_task();
		return true;
	}
	public function up_task(){		
		$goods=$this->getall('goods',array('status'=>1,'uniacid'=>$_SESSION['uniacid']));
		$day=date('Y/m/d');
		$hourkey=$this->model('model')->gethourkey();
		foreach($goods as $item){
			if($item['jian_openday']){
				$this->model('model')->up_yue2canlog($item);
				$this->model('model')->up_can2success($item);
			}else{
				$item['hours']=json_decode($item['jian_hour'.$hourkey],true);
				$start_time=strtotime($day.' '.$item['hours']['start']);
				$end_time=strtotime($day.' '.$item['hours']['end']);
				if(TIMESTAMP>$start_time && TIMESTAMP<$end_time){
					$this->model('model')->up_yue2canlog($item);
				}
				$this->model('model')->up_can2success($item);
			}
		}
		return true;
	}
}